let notes = id("0_resource_name_obfuscated")
  .className("androidx.recyclerview.widget.RecyclerView")
  .scrollable(true)
  .depth(10)
  .findOne()
  .children();
  console.log(111111111, notes.length);
  

if (notes.length > 0) {
  let randomNote = randomChoice(notes);
  console.log(2222222, randomNote);

  // 判断是否笔记 className("android.widget.RelativeLayout")
  console.log(6666666);

  console.log(333333, randomNote.child(0).className().includes("android.widget.RelativeLayout"));

  if (randomNote.child(0).className().includes("android.widget.RelativeLayout")) {
      console.log('随机选择的元素是笔记');
  } else {
      console.log('随机选择的元素不是笔记');
  }

  // randomNote.click();
  // sleep(3000);

  // // 返回搜索结果页
  // id("0_resource_name_obfuscated").className("android.widget.Button").desc("返回").findOne().click();
  // console.log('笔记阅读结束');

  // sleep(2000);
}

// 随机选择
function randomChoice(array) {
  return array[Math.floor(Math.random() * array.length)];
}
